package gxdlxy.zx2201.chat5;

import java.util.Random;

public class RandomPassword {
    char[] cs; // 所有可能出现的字符

    RandomPassword() {
        String strLower = "abcdefghijklmnopqrstuvwxyz";
        String strUpper = strLower.toUpperCase();
        String strNum = "0123456789";
        String strT = "#+";
        this.cs = (strNum + strLower + strUpper + strT).toCharArray();
    }

    public String getPWD() {
        StringBuffer sb = new StringBuffer();
        Random rd = new Random();
        for (int i = 0; i < 8; i++)
            sb.append(this.cs[rd.nextInt(this.cs.length)]);
        return sb.toString();
    }

    public static void main(String[] args) {
        RandomPassword rp = new RandomPassword();
        for (int i = 0; i < 1000; i++)
            System.out.println(rp.getPWD());
    }
}
